﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace BoardBroker
{
    /// <summary>
    /// 灯光板控制命令
    /// </summary>
    public enum LedControlCommand : int
    {
        None = 0,
        Init = 0x01,                   // 初始化电机设备       
        Exit = 0xFF,                             // 退出程序    
        SetLightOn = 0x10,                 // 亮灯
        SetLightOff = 0x11,                 // 灭灯
        SetLedFlash = 0x12,                // 闪灯      
    };

    public enum DeviceType
    {
        None,
        IdCardReader,
        QrCodeScanner,
        Fingerprint,
        SignatureBoard,
        PaperPrinter,
    }

    public enum LEDS : int
    {
        None = 0,
        LED1 = 1,
        LED2 = 2,
        LED3 = 3,
    }

    [DataContract]
    public class LedActionArgs
    {
        /// <summary>
        /// 控制命令
        /// </summary>
        [DataMember]
        public LedControlCommand Command { get; set; } = LedControlCommand.SetLightOn;

        /// <summary>
        /// 灯编号
        /// </summary>    
        [DataMember]
        public LEDS LedNum { get; set; } = LEDS.None;

        /// <summary>
        /// 速度
        /// </summary>
        [DataMember]
        public int Speed { get; set; } = 0;

        /// <summary>
        /// 次数
        /// </summary>
        [DataMember]
        public int Count { get; set; } = 0;

        /// <summary>
        /// 发送命令者的窗口句柄
        /// </summary>
        [DataMember]
        public IntPtr SenderHandle { get; set; }= IntPtr.Zero;
    }

    public class LEDControlActionResult
    {
        /// <summary>
        /// 执行动作类型
        /// </summary>
        public LedControlCommand Command { get; set; }

        /// <summary>
        /// 灯编号
        /// </summary>
        public LEDS LedNum { get; set; }

        /// <summary>
        /// 动作执行完成返回的代码
        /// </summary>
        public int Code { get; set; }

        /// <summary>
        /// 动作执行完成返回的信息
        /// </summary>
        public string Message { get; set; }
    }

}
